Manager for initialization & termination code. More...
#include <finitializer.h>
Public Member Functions | |
OneTimeProcedure (bool isInit, InitTermFunc f=0, FIDString name=0, uint32 level=kInitLevelStd) | |
Register an initialization (isInit = true) or termination (isInit=false) procedure (f) for execution. For convenience, use the INITIALIZE & TERMINATE macros instead of this. | |
Static Public Member Functions | |
static bool | initialize (uint32 untilLevel=kInitLevelLast) |
Execute & discard all registered initialization procedures. If there are different code spots where to execute certain kinds of initialization, utilize initialization levels (see enum InitLevel). | |
static bool | terminate () |
Execute & discard all registered termination procedures. | |
static void | cancel () |
Discard any initialization/termination procedures registered. |
Manager for initialization & termination code.
With this, you may register code to be executed at program startup and/or termination.
This is useful when there is class specific code you need to be executed at program startup/termination, but you want to keep it in the classes source file to keep together the class code.
The steps are:
OneTimeProcedure | ( | bool | isInit, | |
InitTermFunc | f = 0 , |
|||
FIDString | name = 0 , |
|||
uint32 | level = kInitLevelStd | |||
) |
Register an initialization (isInit = true) or termination (isInit=false) procedure (f) for execution. For convenience, use the INITIALIZE & TERMINATE macros instead of this.
bool initialize | ( | uint32 | untilLevel = kInitLevelLast |
) | [static] |
Execute & discard all registered initialization procedures. If there are different code spots where to execute certain kinds of initialization, utilize initialization levels (see enum InitLevel).
bool terminate | ( | ) | [static] |
Execute & discard all registered termination procedures.
void cancel | ( | ) | [static] |
Discard any initialization/termination procedures registered.